import instance from '@/utils/axios.js'
function getCannelList() {
    return instance({
        url: '/v1_0/user/channels',
        method:'get'
    })
}
export { getCannelList }
function getArticleList({channel_id,timestamp}) {
    return instance({
        url: '/v1_0/articles',
        method: 'get',
        params: {
            channel_id,
            timestamp,
            with_top:1
        }
    })
}
//获取文章详情
export { getArticleList }
function getArticleInfo(id) {
    return instance({
        url: `/v1_0/articles/${id}`,
        method:'get'
    })
}
export { getArticleInfo }
//关注用户
function followingUser(id) {
    return instance({
        url: '/v1_0/user/followings',
        method: 'post',
        data: {
            target:id
        }
    })
}
export { followingUser }
//取消关注
function unFollowingUser(id) {
    return instance({
        url: `/v1_0/user/followings/${id}`,
        method: 'delete'
    })
}
export { unFollowingUser }

//点赞
function praiseArticle(id) {
    return instance({
        url: '/v1_0/article/likings',
        method: 'post',
        data: {
            target:id
        }
    })
}
export { praiseArticle }
//取消点赞
function unPraiseArticle(id) {
    return instance({
        url: `/v1_0/article/likings/${id}`,
        method: 'delete'
    })
}
export { unPraiseArticle }
//不喜欢
function dislikeArticle(id) {
    return instance({
        url: '/v1_0/article/dislikes',
        method: 'post',
        data: {
            target:id
        }
    })
}
export { dislikeArticle }
//取消不喜欢
function unDislikeArticle(id) {
    return instance({
        url: `/v1_0/article/dislikes/${id}`,
        method: 'delete'
    })
}
export { unDislikeArticle }
function getSuggestionList(q) {
    return instance({
        url: '/v1_0/suggestion',
        method: 'get',
        params: {
            q
        }
    })
}
export { getSuggestionList }
function getSearchResult(obj) {
    return instance({
        url: '/v1_0/search',
        method: 'get',
        params:obj
    })
}
export{getSearchResult}